package com.oocl.servlet;

import java.io.IOException;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.oocl.util.RequestUtil;

/**
 * Servlet implementation class ListenerServlert
 */
@WebServlet("/sec/listen")
public class ListenerServlert extends HttpServlet {
	private static final long serialVersionUID = 1L;
//	int n=1;
       
    
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.err.println("listener..");
		ServletContext context = request.getSession().getServletContext();
		Object obj = context.getAttribute("pendingCount");
		if(null==obj){
			RequestUtil.sendResponse(false, "", response);
			return;
		}
		int n = ((Integer)context.getAttribute("pendingCount")).intValue();
		
		RequestUtil.sendResponse(true, n, response);
	}

}
